package com.situ.crm.controller;

import com.situ.crm.dao.IUserDao;
import com.situ.crm.dao.impl.UserDaoImpl;
import com.situ.crm.pojo.User;
import com.situ.crm.pojo.UserRoleCount;
import com.situ.crm.util.JSONUtil;
import com.situ.crm.util.Result;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/echarts")
public class EChartsServlet extends HttpServlet {
    private IUserDao userDao = new UserDaoImpl();

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<UserRoleCount> list = userDao.selectRoleCount();

        JSONUtil.toJSON(resp, Result.ok(list));
    }
}
